home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / latexinfo / configure < prev    next >
Text File  |  1991-11-27  |  9KB  |  358 lines

  1. :
  2. # Guess values for system-dependant variables and create `Makefile'.
  3. # Copyright (C) 1991 Free Software Foundation, Inc.
  4. # Viscously hacked my mike@apl.ists.ca
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [+srcdir=DIR] [+host=HOST] [+gas] [+nfp] [TARGET]
  21. # All args except +srcdir=DIR are ignored.
  22.  
  23. trap 'rm -f conftest conftest.c; exit 1' 1 3 15
  24.  
  25. set +u # Make sure unset variables are ok.
  26.  
  27. # Make sure we don't find the System V /etc/install.
  28. PATH=`echo $PATH|sed '
  29. s,^/etc:,,
  30. s,:/etc$,,
  31. s,:/etc:,:,g'`
  32.  
  33. # A filename unique to this package, relative to the directory that
  34. # configure is in, which we can look for to find out if srcdir is correct.
  35. unique_file=.latexinfo
  36.  
  37. for arg in $*; do
  38.   # Handle +srcdir with a space before the argument.
  39.   if [ x$next_srcdir = xyes ]; then srcdir=$arg; next_srcdir=
  40.   # Handle +host with a space before the argument.
  41.   elif [ x$next_host = xyes ]; then next_host=
  42.   else 
  43.     case $arg in
  44.      -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
  45.     srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'` ;;
  46.      -srcdir | +srcdir | +srcdi | +srcd | +src | +sr | +s)
  47.     next_srcdir=yes ;;
  48.      -host=* | +host=* | +hos=* | +ho=* | +h=*) ;;
  49.      -host | +host | +hos | +ho | +h)
  50.     next_host=yes ;;
  51.      -gas | +gas | +ga | +g) ;;
  52.      -nfp | +nfp | +nf | +n) ;;
  53.      *) ;;
  54.     esac
  55.   fi
  56. done
  57.  
  58. vpsub='s@\$\([-./a-zA-Z0-9]*\)<@\1@g'
  59. # Find the source files, if location was not specified.
  60. if [ x$srcdir = x ]; then
  61.   srcdirdefaulted=yes; srcdir=.
  62.   if [ ! -r $unique_file ]; then srcdir=..; fi
  63. fi
  64. if [ $srcdir != . ]; then
  65.   VPATH='VPATH = $(srcdir)'
  66.   vpsub='s@\$\([-./a-zA-Z0-9]*\)<@\$<@g'
  67. fi
  68.  
  69. if [ ! -r $srcdir/$unique_file ]; then
  70.   if [ x$srcdirdefaulted = xyes ]; then
  71.     echo "$0: Can not find sources in \`.' or \`..'." 1>&2
  72.   else
  73.     echo "$0: Can not find sources in \`${srcdir}'." 1>&2
  74.   fi
  75.   exit 1
  76. fi
  77.  
  78. if test "$RANDOM" = "$RANDOM"; then
  79.   # Plain old Bourne shell.
  80.   echo checking for gcc
  81.   test -z "$CC" -a -n "`gcc 2>&1`" && CC="gcc -O"
  82.  
  83.   echo checking for install
  84.   if test -z "$INSTALL" -a -n "`install 2>&1`"; then
  85.     INSTALL="install -c -m 755"
  86.     INSTALLDATA="install -c -m 644"
  87.   fi
  88. else
  89.   # ksh, bash or zsh.  ksh and zsh write "command not found" to stderr.
  90.   echo checking for gcc
  91.   test -z "$CC" && type gcc && CC="gcc -O"
  92.  
  93.   echo checking for install
  94.   if test -z "$INSTALL" && type install; then
  95.     INSTALL="install -c -m 755"
  96.     INSTALLDATA="install -c -m 644"
  97.   fi
  98. fi
  99.  
  100. echo "Where would you like to install the binaries?"
  101. echo ""
  102. peachy="n"
  103. while [ "$peachy" = n ]; do
  104. echo "  Please type the full path to your binaries directory:"
  105. echo -n "  >"
  106. read FOUNDPATH
  107.         if [ -d $FOUNDPATH ]; then
  108.             echo ""
  109.             echo "  The binaries path was verfied to be [$FOUNDPATH]"
  110.             echo ""
  111.             peachy="y"
  112.         else
  113.             echo ""
  114.             echo "  Verification of [$FOUNDPATH] failed. Please try again."
  115.             echo ""
  116.         fi
  117.     done #peachy
  118. BINDIR=${FOUNDPATH-/usr/local/bin}
  119.  
  120. echo "Where are the Gnu Info files located?"
  121. echo ""
  122. peachy="n"
  123. while [ "$peachy" = n ]; do
  124. echo "  Please type the full path to your info directory:"
  125. echo -n "  >"
  126. read FOUNDPATH
  127.         if [ -d $FOUNDPATH ]; then
  128.             echo ""
  129.             echo "  The Info directory was verfied to be [$FOUNDPATH]"
  130.             echo ""
  131.             peachy="y"
  132.         else
  133.             echo ""
  134.             echo "  Verification of [$FOUNDPATH] failed. Please try again."
  135.             echo ""
  136.         fi
  137.     done #peachy
  138. INFODIR=${FOUNDPATH-/usr/local/info}
  139.  
  140. echo "Where is your GNU Emacs command:"
  141. echo ""
  142. echo "  Please type the name of your GNU Emacs command:"
  143. echo -n "  >"
  144. read FOUND
  145. EMACS="$FOUND"
  146. EMACS=${EMACS-/usr/local/man/man1}
  147.  
  148. CC=${CC-cc}
  149. INSTALL=${INSTALL-cp}
  150. INSTALLDATA=${INSTALLDATA-cp}
  151. INCLUDEDIR=${INCLUDEDIR-/usr/include}
  152.  
  153. if test -z "$PWD" ; then
  154.    PWD=`pwd`
  155. fi
  156. rm -f .login .emacs
  157. cat << 'EOF'
  158.  
  159. Would you like to install the elisp and LaTeX files elsewhere,
  160. or leave them here, and set an environment variable to point to here?
  161.  
  162. EOF
  163. echo -n 'Set an environment variable to point to here [y/n]? '
  164. read HERE
  165. if [ "$HERE" = "y" ] ; then
  166.     cat >.emacs << 'EOF'
  167. ;; Modify the following line to be the name of this file, and
  168. ;; put it in your ~/.emacs (without the semi-colons).
  169. ;; (load-file "/usr2/ai/nesc/.emacs")
  170.  
  171. ;;; LaTeXinfo
  172.  
  173. (setq load-path 
  174.       (cons (setq latexinfo-formats-directory
  175.           (expand-file-name (concat (getenv "LATEXINFO") "/elisp")))
  176.         load-path))
  177.  
  178. EOF
  179.     cat .latexinfo >> .emacs
  180.     cat >.login << EOF
  181. #!/bin/csh
  182.  
  183. # LaTeXinfo
  184. setenv LATEXINFO $PWD
  185. EOF
  186.     cat >>.login << 'EOF'
  187.  
  188. # Add the format files to the list of directories that LaTeX searches.
  189. if ( $?TEXINPUTS ) then
  190.     setenv TEXINPUTS "$TEXINPUTS"':'"$LATEXINFO/styles"
  191. else
  192.     setenv TEXINPUTS ".:$LATEXINFO/styles"
  193. endif
  194. EOF
  195.  
  196. else
  197.    echo ""
  198.    echo "Where would you like to install GNU Emacs code (elisp)?"
  199.    echo ""
  200.    peachy="n"
  201.    while [ "$peachy" = n ]; do
  202.    echo "  Please type the full path to your elisp directory:"
  203.    echo -n "  >"
  204.    read FOUNDPATH
  205.            if [ -d $FOUNDPATH ]; then
  206.                echo ""
  207.                echo "  The elisp path was verfied to be [$FOUNDPATH]"
  208.                echo ""
  209.                peachy="y"
  210.            else
  211.                echo ""
  212.                echo "  Verification of [$FOUNDPATH] failed. Please try again."
  213.                echo ""
  214.            fi
  215.        done #peachy
  216.    ELISPDIR=${FOUNDPATH-/usr/local/emacs/lisp}
  217.    
  218.    echo "Where would you like to install the LaTeX style files?"
  219.    echo ""
  220.    peachy="n"
  221.    while [ "$peachy" = n ]; do
  222.    echo "  Please type the full path to your LaTeX style directory:"
  223.    echo -n "  >"
  224.    read FOUNDPATH
  225.            if [ -d $FOUNDPATH ]; then
  226.                echo ""
  227.                echo "  The  LaTeX style path was verfied to be [$FOUNDPATH]"
  228.                echo ""
  229.                peachy="y"
  230.            else
  231.                echo ""
  232.                echo "  Verification of [$FOUNDPATH] failed. Please try again."
  233.                echo ""
  234.            fi
  235.        done #peachy
  236.    TEXDIR=${FOUNDPATH-/usr/local/tex/inputs}
  237.  
  238.    cat >.emacs << EOF
  239. ;; Modify the following line to be the name of this file, and
  240. ;; put it in your ~/.emacs (without the semi-colons).
  241. ;; (load-file "/usr2/ai/nesc/.emacs")
  242.  
  243. ;;; LaTeXinfo
  244. (setq load-path 
  245.       (cons (setq latexinfo-formats-directory
  246.           (expand-file-name "$ELISPDIR"))
  247.         load-path))
  248.  
  249. EOF
  250.     cat .latexinfo >> .emacs
  251.     cat >>.login << EOF
  252.  
  253. # Add the format files to the list of directories that LaTeX searches.
  254. if ( \$?TEXINPUTS ) then
  255.     setenv TEXINPUTS "\$TEXINPUTS"':'"$TEXDIR"
  256. else
  257.     setenv TEXINPUTS ".:$TEXDIR"
  258. endif
  259. EOF
  260.  
  261. fi
  262.  
  263. # Set LATEXINFO for the install
  264. LATEXINFO=$PWD
  265.  
  266. rm -f conftest conftest.c
  267. compile="$CC $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1"
  268.  
  269. # Check for various header files.
  270.  
  271. echo checking for ANSI C header files
  272. echo "#include <stdlib.h>
  273. #include <string.h>
  274. main () { exit(0); strerror(0); }" > conftest.c
  275. eval $compile
  276. if test -s conftest && ./conftest 2>/dev/null; then
  277.   DEFS="$DEFS -DSTDC_HEADERS"
  278. fi
  279. rm -f conftest conftest.c
  280.  
  281. echo checking for BSD string and memory functions
  282. echo "#include <strings.h>
  283. main () { exit(0); rindex(0, 0); bzero(0, 0); }" > conftest.c
  284. eval $compile
  285. if test -s conftest && ./conftest 2>/dev/null; then :
  286.   else DEFS="$DEFS -DUSG"
  287. fi
  288. rm -f conftest conftest.c
  289.  
  290. # Check other misc. things.
  291.  
  292. echo checking how to get alloca
  293. echo '
  294. #ifdef __GNUC__
  295. #define alloca __builtin_alloca
  296. #else
  297. #ifdef sparc
  298. #include <alloca.h>
  299. #else
  300. #ifdef _AIX
  301.  #pragma alloca
  302. #else
  303. char *alloca ();
  304. #endif
  305. #endif
  306. #endif
  307. main() { char *p = (char *) alloca(1); exit(0); }' > conftest.c
  308. eval $compile
  309. if test -s conftest && ./conftest 2>/dev/null; then :
  310. else
  311.   rm -f conftest conftest.c
  312.   echo 'char *alloca();
  313. main() { char *p = alloca(1); exit(0); }' > conftest.c
  314.   eval $compile -lPW
  315.   if test -s conftest && ./conftest 2>/dev/null; then LIBS="$LIBS -lPW"
  316.   elif test -d /usr/ucblib; then LIBS="$LIBS -L/usr/ucblib -lucb"
  317.   else ALLOCA=alloca.o
  318.   fi
  319. fi
  320. rm -f conftest conftest.c
  321.  
  322. trap "rm -f config.status $srcdir/C/Makefile; exit 1" 1 3 15
  323.  
  324. echo "CC=$CC
  325. INSTALL=$INSTALL
  326. INSTALLDATA=$INSTALLDATA
  327. DEFS=$DEFS
  328. LIBS=$LIBS
  329. BINDIR=$BINDIR
  330. INFODIR=$INFODIR
  331. ELISPDIR=$ELISPDIR
  332. TEXDIR=$TEXDIR
  333. EMACS=$EMACS
  334. LATEXINFO=$PWD
  335. ALLOCA=$ALLOCA" > config.status
  336. echo '# Generated automatically from Makefile.in by configure.' > $srcdir/C/Makefile
  337. sed -e "
  338. $vpsub
  339. s,@srcdir@,$srcdir,
  340. s,@VPATH@,$VPATH,
  341. s,@CC@,$CC,
  342. s,@INSTALL@,$INSTALL,
  343. s,@INSTALLDATA@,$INSTALLDATA,
  344. s,@DEFS@,$DEFS,
  345. s,@LIBS@,$LIBS,
  346. s,@BINDIR@,$BINDIR,
  347. s,@MANDIR@,$MANDIR,
  348. s,@INFODIR@,$INFODIR,
  349. s,@ALLOCA@,$ALLOCA,
  350. " $srcdir/C/Makefile.in >> $srcdir/C/Makefile
  351.  
  352. if [ "$HERE" = "y" ] ; then
  353.     echo "Now type make"
  354. else
  355.     echo "Now type make, then"
  356.     echo "         make install"
  357. fi
  358.